<?php

namespace App\Http\Requests\Dashboard;

use App\Models\Course;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class CourseStoreRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => ['required', 'max:255', 'string'],
            'description' => ['string', 'nullable'],
            'content_type' => ['nullable', Rule::in(array_keys(Course::CONTENT_TYPES))],
            'course_type' => ['required', Rule::in(array_keys(Course::COURSE_TYPES))],
            'content' => ['nullable', 'string',],
            'exp' => ['numeric'],
            'depth' => ['numeric'],
            'event' => ['array'],
            'complete_conditions' => ['array']
        ];
    }
}
